subroutine readdiss(lunit,t_array0,myrank)
  use param
  use data_param,only:dsfn,diss_exist,n_diss_data
  use label_data_param,only:obj_type
  implicit none
  
  interface
     integer function str2label(str)
       character :: str*(*)
     end function str2label
  end interface

  integer,intent(in) :: lunit,t_array0(8),myrank
  
  integer :: nunit,count_line,len_str,asci_code
  character(len=len_linebuf) :: eatline
  character(len=len_wordbuf),dimension(max_n_word) :: eatword
  character(len=8) :: d_time_str

  integer :: i,j,n,m,l
  integer :: lid,nd,id

  if (.not.diss_exist) return

  nunit=1

  open(unit=nunit,file=dsfn,status='old',err=103)

  count_line=0
  n=0
  do
     read(nunit,'(a)',end=100,err=101) eatline
     count_line=count_line+1
     len_str=len_trim(eatline)
     if (len_str.eq.0) cycle
     eatline=adjustl(eatline)
     asci_code=ichar(eatline(1:1))
     if (asci_code.eq.ccode) cycle
     read(eatline(1:len_str),*,end=102) &
          (eatword(i),i=1,max_n_word)
102  continue

     ! c1:label
     ! c2:Does it dissociate?
     ! c3:energy barrier
     ! c4:prefactor
     ! c5:dissociation distance
     ! c6:number of objects made after dissociation
     ! c7:types made after dissociation
     lid=str2label(eatword(1))
     if (lid.eq.0) call abnormal_stop("readdiss",&
          "Unrecognized label is found in diss file.")
     
     n=n+1
     n_diss_data=n

     read(eatword(2),*) m
     if (m.eq.0) cycle
     
     obj_type(lid)%does_diss=.true.
     obj_type(lid)%diss_type=m

     allocate(obj_type(lid)%diss_eb(m))
     allocate(obj_type(lid)%diss_nu(m))
     allocate(obj_type(lid)%diss_rd(m))
     allocate(obj_type(lid)%diss_const_rate(m))
     allocate(obj_type(lid)%n_diss(m))
     allocate(obj_type(lid)%diss_obj(m))

     ! Read first line
     read(eatword(3),*) obj_type(lid)%diss_eb(1)
     read(eatword(4),*) obj_type(lid)%diss_nu(1)
     read(eatword(5),*) obj_type(lid)%diss_rd(1)
     read(eatword(6),*) nd
     obj_type(lid)%n_diss(1)=nd
     allocate(obj_type(lid)%diss_obj(1)%diss_type(nd))

     ! Read associated objects
     do i=1,nd
        id=str2label(eatword(6+i))
        if (id.eq.0) then
           call terminal_msg1(trim(adjustl(eatline)))
           call abnormal_stop("readdiss",&
                "Unrecognized label is found in diss data.")
         end if
         obj_type(lid)%diss_obj(1)%diss_type(i)=id
     end do

     ! Read additional lines
     do l=2,m
        read(nunit,'(a)',end=100,err=101) eatline
        count_line=count_line+1
        len_str=len_trim(eatline)
        if (len_str.eq.0) cycle
        eatline=adjustl(eatline)
        asci_code=ichar(eatline(1:1))
        if (asci_code.eq.ccode) cycle
        read(eatline(1:len_str),*,end=104) &
             (eatword(i),i=1,max_n_word)
104     continue

        ! c1:energy barrier
        ! c2:prefactor
        ! c3:dissociation distance
        ! c4:number of objects made after dissociation
        ! c5:types made after dissociation
        read(eatword(1),*) obj_type(lid)%diss_eb(l)
        read(eatword(2),*) obj_type(lid)%diss_nu(l)
        read(eatword(3),*) obj_type(lid)%diss_rd(l)
        read(eatword(4),*) nd
        obj_type(lid)%n_diss(l)=nd
        allocate(obj_type(lid)%diss_obj(l)%diss_type(nd))

        do i=1,nd
           id=str2label(eatword(4+i))
           if (id.eq.0) then
              call terminal_msg1(trim(adjustl(eatline)))
              call abnormal_stop("readdiss",&
                   "Unrecognized label is found in diss data.")
           end if
           obj_type(lid)%diss_obj(l)%diss_type(i)=id
        end do
     end do

  end do

103 continue
  call abnormal_stop("readdiff",&
       "Error occurs while the diss file opens.")

101 continue
  call abnormal_stop("readdiff",&
       "Error occurs during readig the diss file.")

100 continue

  close(nunit)

  ! Print the label file info.
  call log_msg1(lunit,"")
  call log_msg1(lunit,"Message from the subourinte (readdiss)")
  call log_msg1(lunit,"")
  write(lunit,'(1x,i0,1x,"lines read from the ",a)') &
       count_line,trim(dsfn)
  write(lunit,'(1x,"Number of dissociation data=",1x,i0)') &
       n_diss_data

  ! Write the message to the terminal and log file
  call print_d_time(t_array0,d_time_str)
  if (myrank.eq.0) &
       write(*,'(a8,":READDISS DONE.")') d_time_str(1:8)
  write(lunit,*)
  write(lunit,'(a8,":READDISS DONE.")') d_time_str(1:8)  

  return

end subroutine readdiss
